home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / gopher / Rice_CMS / gopher24 / gopclini.exec < prev    next >
Encoding:
Text File  |  1993-01-22  |  4.3 KB  |  141 lines

  1. /*
  2.  *        Name: GOPCLINI EXEC
  3.  *              CMS InterNet Gopher (client) initialization
  4.  *      Author: Rick Troth, Rice University, Information Systems
  5.  *        Date: 1992-Dec-23, 1993-Jan-22
  6.  */
  7.  
  8. /*
  9.  *      Copyright 1992 Richard M. Troth.   This software was developed
  10.  *      with resources provided by Rice University and is intended
  11.  *      to serve Rice's user community.   Rice has benefitted greatly
  12.  *      from the free distribution of software,  therefore distribution
  13.  *      of unmodified copies of this material is not restricted.
  14.  *      You may change your own copy as needed.   Neither Rice
  15.  *      University nor any of its employees or students shall be held
  16.  *      liable for damages resulting from the use of this software.
  17.  */
  18.  
  19. Trace "OFF"
  20.  
  21. Address "COMMAND"
  22.  
  23. Parse Upper Arg . '(' opts ')' .
  24. fsin = 1;   load = 1
  25. Do While opts ^= ""
  26.     Parse Var opts op opts
  27.     Select  /*  op  */
  28.         When  Abbrev("UNLOAD",op,3)     Then  Signal  UNLOAD
  29.         When  Abbrev("NOSCREEN",op,3)   Then  fsin = 0
  30.         When  Abbrev("NOLOAD",op,3)     Then  load = 0
  31.         When  Abbrev("SCREEN",op,3)     Then  fsin = 1
  32.         When  Abbrev("LOAD",op,1)       Then  load = 1
  33.         Otherwise 'XMITMSG 3 OP (ERRMSG'
  34.         End  Select  /*  op  */
  35.     End  /*  Do  While  */
  36.  
  37. 'SET LANGUAGE (ADD GOP USER'
  38. If rc ^= 0 Then Exit rc
  39.  
  40. /*  fetch the program ID string  */
  41. 'PIPE COMMAND XMITMSG 0 (APPLID GOP CALLER CLI NOHEADER | VAR PROGID'
  42.  
  43. /*  migrate old bookmarks  */
  44. 'EXEC GOPHMARK'
  45.  
  46. Parse Upper Arg tube . '(' . ')' .
  47.  
  48. 'GLOBALV SELECT GOPHER PUT GOPHER PROGID TUBE'
  49. 'GLOBALV SELECT GOPHER SET ITEM'
  50. 'GLOBALV SELECT GOPHER SET COMMAND'
  51.  
  52. /*  initialize screen variables  */
  53. If fsin Then Do
  54.     If ^Datatype(tube,'X') Then 'VMFCLEAR'      /*  clear if cons  */
  55.     Call FSINIT tube            /*  figure out some screen attribs  */
  56.     'PIPE REXXVARS | DROP | JOIN 1 /,/ | LOCATE /n FS./' ,
  57.             '| CHANGE /n /GLOBALV SELECT GOPHER SETL / 1' ,
  58.                     '| CHANGE /,v / / 1 | COMMAND'
  59.     End  /*  If  ..  Do  */
  60.  
  61. /*  load client gems into memory for efficiency  */
  62. If load Then
  63. 'PIPE CMS L GOPCLI* REXX * | SPEC /EXECLOAD / 1 1-* NEXT | COMMAND'
  64.  
  65. Exit
  66.  
  67.  
  68.  
  69. /* -------------------------------------------------------------- FSINIT
  70.  * Initialize variables used in building screen displays.
  71.  * (this code comes from Chuck Boeheim's PIPEDEMO; Thanks, Chuck!)
  72.  */
  73. FSINIT:   Procedure Expose fs.
  74. Parse Arg t
  75. fs.tube = t
  76.  
  77. If Datatype(fs.tube,'X') Then Do
  78.  
  79.     /*----------------------------------------------------------------*/
  80.     /*  a dialed 3270 with pessimistic assumptions                    */
  81.     /*----------------------------------------------------------------*/
  82.  
  83.     fs.scrrows = 24
  84.     fs.scrcols = 80
  85.     fs.write  = '80'x
  86.     flags = '00'x
  87.  
  88.     End  /*  If  ..  Do  */
  89.  
  90. Else Do
  91.  
  92.     /*----------------------------------------------------------------*/
  93.     /*  Get the screen size from CP.                                  */
  94.     /*----------------------------------------------------------------*/
  95.  
  96.     Parse Value Diag('8C') with flags +1 3 fs.scrcols +2 fs.scrrows +2 .
  97.     fs.scrrows = c2d(fs.scrrows)
  98.     fs.scrcols = c2d(fs.scrcols)
  99.  
  100.     If  fs.scrrows > 24 | fs.scrcols > 80   Then fs.write = 'C0'x
  101.                                             Else fs.write = '80'x
  102.  
  103.     End  /*  Else  Do  */
  104.  
  105. fs.operwa = 'C0'x       /* Erase/Write alternate      */
  106. fs.operw  = '80'x       /* Erase/Write                */
  107. fs.opwr   = '00'x       /* Write                      */
  108. fs.oprd   = '06'x       /* Read modified.             */
  109.  
  110. fs.wcc    = '03'x       /* Unlock keyboard, reset mdt */
  111.  
  112. fs.high   = '1DE8'x     /* Protected, highlighted.    */
  113. fs.low    = '1D60'x     /* Protected, normal.         */
  114. fs.ic     = '13'x       /* Insert cursor.             */
  115.  
  116. fs.color = (bitand(flags,'80'x) = '80'x)
  117. fs.exthi = (bitand(flags,'40'x) = '40'x)
  118. fs.pss   = (bitand(flags,'20'x) = '20'x)
  119. fs.7171  = (bitand(flags,'02'x) = '02'x)
  120. fs.14bit = (bitand(flags,'01'x) = '01'x)
  121.  
  122. Return
  123.  
  124.  
  125.  
  126. /* -------------------------------------------------------------- UNLOAD
  127.  *  Unload Gopher EXECs, pipeline stages, messages to free-up memory.
  128.  */
  129. UNLOAD:
  130.  
  131. 'PIPE COMMAND EXECMAP | LOCATE 1.3 /GOP/' ,
  132.         '| SPEC /EXECDROP / 1 1.20 NEXT | COMMAND'
  133. If rc ^= 0 Then Exit rc
  134.  
  135. 'SET LANGUAGE (DELETE GOP USER'
  136.  
  137. If rc ^= 0 Then Exit rc
  138.  
  139. Exit
  140.  
  141.